package jehc.djshi.log.service.impl;

import jehc.djshi.common.base.BaseService;
import jehc.djshi.common.util.ExceptionUtil;
import jehc.djshi.log.dao.LogErrorDao;
import jehc.djshi.log.model.LogError;
import jehc.djshi.log.service.LogErrorService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
/**
* @Desc 异常日志表 
* @Author 邓纯杰
* @CreateTime 2022-08-24 11:24:05
*/
@Service
public class LogErrorServiceImpl extends BaseService implements LogErrorService{

	@Resource
	private LogErrorDao logErrorDao;

	/**
	* 分页
	* @param condition 
	* @return
	*/
	public List<LogError> getLogErrorListByCondition(Map<String,Object> condition){
		try{
			return logErrorDao.getLogErrorListByCondition(condition);
		} catch (Exception e) {
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
	}

	/**
	* 查询对象
	* @param id 
	* @return
	*/
	public LogError getLogErrorById(String id){
		try{
			LogError logError = logErrorDao.getLogErrorById(id);
			return logError;
		} catch (Exception e) {
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
	}

	/**
	* 添加
	* @param logError 
	* @return
	*/
	public int addLogError(LogError logError){
		int i = 0;
		try {
			i = logErrorDao.addLogError(logError);
		} catch (Exception e) {
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
		return i;
	}

	/**
	* 修改
	* @param logError 
	* @return
	*/
	public int updateLogError(LogError logError){
		int i = 0;
		try {
			i = logErrorDao.updateLogError(logError);
		} catch (Exception e) {
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
		return i;
	}

	/**
	* 修改（根据动态条件）
	* @param logError 
	* @return
	*/
	public int updateLogErrorBySelective(LogError logError){
		int i = 0;
		try {
			i = logErrorDao.updateLogErrorBySelective(logError);
		} catch (Exception e) {
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
		return i;
	}

	/**
	* 删除
	* @param condition 
	* @return
	*/
	public int delLogError(Map<String,Object> condition){
		int i = 0;
		try {
			i = logErrorDao.delLogError(condition);
		} catch (Exception e) {
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
		return i;
	}
}
